/**
 * Copyright (c) 2000-2012 Liferay, Inc. All rights reserved.
 *
 * This library is free software; you can redistribute it and/or modify it under
 * the terms of the GNU Lesser General Public License as published by the Free
 * Software Foundation; either version 2.1 of the License, or (at your option)
 * any later version.
 *
 * This library is distributed in the hope that it will be useful, but WITHOUT
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
 * FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
 * details.
 */

package slcu.service.persistence;

import com.liferay.portal.NoSuchModelException;
import com.liferay.portal.kernel.bean.BeanReference;
import com.liferay.portal.kernel.cache.CacheRegistryUtil;
import com.liferay.portal.kernel.dao.jdbc.MappingSqlQuery;
import com.liferay.portal.kernel.dao.jdbc.MappingSqlQueryFactoryUtil;
import com.liferay.portal.kernel.dao.jdbc.RowMapper;
import com.liferay.portal.kernel.dao.orm.EntityCacheUtil;
import com.liferay.portal.kernel.dao.orm.FinderCacheUtil;
import com.liferay.portal.kernel.dao.orm.FinderPath;
import com.liferay.portal.kernel.dao.orm.Query;
import com.liferay.portal.kernel.dao.orm.QueryPos;
import com.liferay.portal.kernel.dao.orm.QueryUtil;
import com.liferay.portal.kernel.dao.orm.SQLQuery;
import com.liferay.portal.kernel.dao.orm.Session;
import com.liferay.portal.kernel.exception.SystemException;
import com.liferay.portal.kernel.log.Log;
import com.liferay.portal.kernel.log.LogFactoryUtil;
import com.liferay.portal.kernel.util.GetterUtil;
import com.liferay.portal.kernel.util.InstanceFactory;
import com.liferay.portal.kernel.util.OrderByComparator;
import com.liferay.portal.kernel.util.PropsKeys;
import com.liferay.portal.kernel.util.PropsUtil;
import com.liferay.portal.kernel.util.StringBundler;
import com.liferay.portal.kernel.util.StringPool;
import com.liferay.portal.kernel.util.StringUtil;
import com.liferay.portal.kernel.util.Validator;
import com.liferay.portal.model.CacheModel;
import com.liferay.portal.model.ModelListener;
import com.liferay.portal.service.persistence.BatchSessionUtil;
import com.liferay.portal.service.persistence.ResourcePersistence;
import com.liferay.portal.service.persistence.UserPersistence;
import com.liferay.portal.service.persistence.impl.BasePersistenceImpl;

import slcu.NoSuchDeportistaException;

import slcu.model.Deportista;

import slcu.model.impl.DeportistaImpl;
import slcu.model.impl.DeportistaModelImpl;

import java.io.Serializable;

import java.util.ArrayList;
import java.util.Collections;
import java.util.List;

/**
 * The persistence implementation for the Deportista service.
 *
 * <p>
 * Caching information and settings can be found in <code>portal.properties</code>
 * </p>
 *
 * @author tito
 * @see DeportistaPersistence
 * @see DeportistaUtil
 * @generated
 */
public class DeportistaPersistenceImpl extends BasePersistenceImpl<Deportista>
	implements DeportistaPersistence {
	/*
	 * NOTE FOR DEVELOPERS:
	 *
	 * Never modify or reference this class directly. Always use {@link DeportistaUtil} to access the Deportista persistence. Modify <code>service.xml</code> and rerun ServiceBuilder to regenerate this class.
	 */
	public static final String FINDER_CLASS_NAME_ENTITY = DeportistaImpl.class.getName();
	public static final String FINDER_CLASS_NAME_LIST_WITH_PAGINATION = FINDER_CLASS_NAME_ENTITY +
		".List1";
	public static final String FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION = FINDER_CLASS_NAME_ENTITY +
		".List2";
	public static final FinderPath FINDER_PATH_WITH_PAGINATION_FIND_BY_DNI = new FinderPath(DeportistaModelImpl.ENTITY_CACHE_ENABLED,
			DeportistaModelImpl.FINDER_CACHE_ENABLED, DeportistaImpl.class,
			FINDER_CLASS_NAME_LIST_WITH_PAGINATION, "findByDNI",
			new String[] {
				String.class.getName(),
				
			"java.lang.Integer", "java.lang.Integer",
				"com.liferay.portal.kernel.util.OrderByComparator"
			});
	public static final FinderPath FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_DNI = new FinderPath(DeportistaModelImpl.ENTITY_CACHE_ENABLED,
			DeportistaModelImpl.FINDER_CACHE_ENABLED, DeportistaImpl.class,
			FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION, "findByDNI",
			new String[] { String.class.getName() },
			DeportistaModelImpl.DNI_COLUMN_BITMASK);
	public static final FinderPath FINDER_PATH_COUNT_BY_DNI = new FinderPath(DeportistaModelImpl.ENTITY_CACHE_ENABLED,
			DeportistaModelImpl.FINDER_CACHE_ENABLED, Long.class,
			FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION, "countByDNI",
			new String[] { String.class.getName() });
	public static final FinderPath FINDER_PATH_WITH_PAGINATION_FIND_BY_INSCRIPCIONUSERID =
		new FinderPath(DeportistaModelImpl.ENTITY_CACHE_ENABLED,
			DeportistaModelImpl.FINDER_CACHE_ENABLED, DeportistaImpl.class,
			FINDER_CLASS_NAME_LIST_WITH_PAGINATION, "findByinscripcionUserId",
			new String[] {
				Long.class.getName(),
				
			"java.lang.Integer", "java.lang.Integer",
				"com.liferay.portal.kernel.util.OrderByComparator"
			});
	public static final FinderPath FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_INSCRIPCIONUSERID =
		new FinderPath(DeportistaModelImpl.ENTITY_CACHE_ENABLED,
			DeportistaModelImpl.FINDER_CACHE_ENABLED, DeportistaImpl.class,
			FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION,
			"findByinscripcionUserId", new String[] { Long.class.getName() },
			DeportistaModelImpl.INSCRIPCIONSTATUSBYUSERID_COLUMN_BITMASK);
	public static final FinderPath FINDER_PATH_COUNT_BY_INSCRIPCIONUSERID = new FinderPath(DeportistaModelImpl.ENTITY_CACHE_ENABLED,
			DeportistaModelImpl.FINDER_CACHE_ENABLED, Long.class,
			FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION,
			"countByinscripcionUserId", new String[] { Long.class.getName() });
	public static final FinderPath FINDER_PATH_WITH_PAGINATION_FIND_ALL = new FinderPath(DeportistaModelImpl.ENTITY_CACHE_ENABLED,
			DeportistaModelImpl.FINDER_CACHE_ENABLED, DeportistaImpl.class,
			FINDER_CLASS_NAME_LIST_WITH_PAGINATION, "findAll", new String[0]);
	public static final FinderPath FINDER_PATH_WITHOUT_PAGINATION_FIND_ALL = new FinderPath(DeportistaModelImpl.ENTITY_CACHE_ENABLED,
			DeportistaModelImpl.FINDER_CACHE_ENABLED, DeportistaImpl.class,
			FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION, "findAll", new String[0]);
	public static final FinderPath FINDER_PATH_COUNT_ALL = new FinderPath(DeportistaModelImpl.ENTITY_CACHE_ENABLED,
			DeportistaModelImpl.FINDER_CACHE_ENABLED, Long.class,
			FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION, "countAll", new String[0]);

	/**
	 * Caches the Deportista in the entity cache if it is enabled.
	 *
	 * @param deportista the Deportista
	 */
	public void cacheResult(Deportista deportista) {
		EntityCacheUtil.putResult(DeportistaModelImpl.ENTITY_CACHE_ENABLED,
			DeportistaImpl.class, deportista.getPrimaryKey(), deportista);

		deportista.resetOriginalValues();
	}

	/**
	 * Caches the Deportistas in the entity cache if it is enabled.
	 *
	 * @param deportistas the Deportistas
	 */
	public void cacheResult(List<Deportista> deportistas) {
		for (Deportista deportista : deportistas) {
			if (EntityCacheUtil.getResult(
						DeportistaModelImpl.ENTITY_CACHE_ENABLED,
						DeportistaImpl.class, deportista.getPrimaryKey()) == null) {
				cacheResult(deportista);
			}
			else {
				deportista.resetOriginalValues();
			}
		}
	}

	/**
	 * Clears the cache for all Deportistas.
	 *
	 * <p>
	 * The {@link com.liferay.portal.kernel.dao.orm.EntityCache} and {@link com.liferay.portal.kernel.dao.orm.FinderCache} are both cleared by this method.
	 * </p>
	 */
	@Override
	public void clearCache() {
		if (_HIBERNATE_CACHE_USE_SECOND_LEVEL_CACHE) {
			CacheRegistryUtil.clear(DeportistaImpl.class.getName());
		}

		EntityCacheUtil.clearCache(DeportistaImpl.class.getName());

		FinderCacheUtil.clearCache(FINDER_CLASS_NAME_ENTITY);
		FinderCacheUtil.clearCache(FINDER_CLASS_NAME_LIST_WITH_PAGINATION);
		FinderCacheUtil.clearCache(FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION);
	}

	/**
	 * Clears the cache for the Deportista.
	 *
	 * <p>
	 * The {@link com.liferay.portal.kernel.dao.orm.EntityCache} and {@link com.liferay.portal.kernel.dao.orm.FinderCache} are both cleared by this method.
	 * </p>
	 */
	@Override
	public void clearCache(Deportista deportista) {
		EntityCacheUtil.removeResult(DeportistaModelImpl.ENTITY_CACHE_ENABLED,
			DeportistaImpl.class, deportista.getPrimaryKey());

		FinderCacheUtil.clearCache(FINDER_CLASS_NAME_LIST_WITH_PAGINATION);
		FinderCacheUtil.clearCache(FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION);
	}

	@Override
	public void clearCache(List<Deportista> deportistas) {
		FinderCacheUtil.clearCache(FINDER_CLASS_NAME_LIST_WITH_PAGINATION);
		FinderCacheUtil.clearCache(FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION);

		for (Deportista deportista : deportistas) {
			EntityCacheUtil.removeResult(DeportistaModelImpl.ENTITY_CACHE_ENABLED,
				DeportistaImpl.class, deportista.getPrimaryKey());
		}
	}

	/**
	 * Creates a new Deportista with the primary key. Does not add the Deportista to the database.
	 *
	 * @param deportistaId the primary key for the new Deportista
	 * @return the new Deportista
	 */
	public Deportista create(long deportistaId) {
		Deportista deportista = new DeportistaImpl();

		deportista.setNew(true);
		deportista.setPrimaryKey(deportistaId);

		return deportista;
	}

	/**
	 * Removes the Deportista with the primary key from the database. Also notifies the appropriate model listeners.
	 *
	 * @param deportistaId the primary key of the Deportista
	 * @return the Deportista that was removed
	 * @throws slcu.NoSuchDeportistaException if a Deportista with the primary key could not be found
	 * @throws SystemException if a system exception occurred
	 */
	public Deportista remove(long deportistaId)
		throws NoSuchDeportistaException, SystemException {
		return remove(Long.valueOf(deportistaId));
	}

	/**
	 * Removes the Deportista with the primary key from the database. Also notifies the appropriate model listeners.
	 *
	 * @param primaryKey the primary key of the Deportista
	 * @return the Deportista that was removed
	 * @throws slcu.NoSuchDeportistaException if a Deportista with the primary key could not be found
	 * @throws SystemException if a system exception occurred
	 */
	@Override
	public Deportista remove(Serializable primaryKey)
		throws NoSuchDeportistaException, SystemException {
		Session session = null;

		try {
			session = openSession();

			Deportista deportista = (Deportista)session.get(DeportistaImpl.class,
					primaryKey);

			if (deportista == null) {
				if (_log.isWarnEnabled()) {
					_log.warn(_NO_SUCH_ENTITY_WITH_PRIMARY_KEY + primaryKey);
				}

				throw new NoSuchDeportistaException(_NO_SUCH_ENTITY_WITH_PRIMARY_KEY +
					primaryKey);
			}

			return remove(deportista);
		}
		catch (NoSuchDeportistaException nsee) {
			throw nsee;
		}
		catch (Exception e) {
			throw processException(e);
		}
		finally {
			closeSession(session);
		}
	}

	@Override
	protected Deportista removeImpl(Deportista deportista)
		throws SystemException {
		deportista = toUnwrappedModel(deportista);

		Session session = null;

		try {
			session = openSession();

			BatchSessionUtil.delete(session, deportista);
		}
		catch (Exception e) {
			throw processException(e);
		}
		finally {
			closeSession(session);
		}

		clearCache(deportista);

		return deportista;
	}

	@Override
	public Deportista updateImpl(slcu.model.Deportista deportista, boolean merge)
		throws SystemException {
		deportista = toUnwrappedModel(deportista);

		boolean isNew = deportista.isNew();

		DeportistaModelImpl deportistaModelImpl = (DeportistaModelImpl)deportista;

		Session session = null;

		try {
			session = openSession();

			BatchSessionUtil.update(session, deportista, merge);

			deportista.setNew(false);
		}
		catch (Exception e) {
			throw processException(e);
		}
		finally {
			closeSession(session);
		}

		FinderCacheUtil.clearCache(FINDER_CLASS_NAME_LIST_WITH_PAGINATION);

		if (isNew || !DeportistaModelImpl.COLUMN_BITMASK_ENABLED) {
			FinderCacheUtil.clearCache(FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION);
		}

		else {
			if ((deportistaModelImpl.getColumnBitmask() &
					FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_DNI.getColumnBitmask()) != 0) {
				Object[] args = new Object[] {
						deportistaModelImpl.getOriginalDni()
					};

				FinderCacheUtil.removeResult(FINDER_PATH_COUNT_BY_DNI, args);
				FinderCacheUtil.removeResult(FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_DNI,
					args);

				args = new Object[] { deportistaModelImpl.getDni() };

				FinderCacheUtil.removeResult(FINDER_PATH_COUNT_BY_DNI, args);
				FinderCacheUtil.removeResult(FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_DNI,
					args);
			}

			if ((deportistaModelImpl.getColumnBitmask() &
					FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_INSCRIPCIONUSERID.getColumnBitmask()) != 0) {
				Object[] args = new Object[] {
						Long.valueOf(deportistaModelImpl.getOriginalInscripcionStatusByUserId())
					};

				FinderCacheUtil.removeResult(FINDER_PATH_COUNT_BY_INSCRIPCIONUSERID,
					args);
				FinderCacheUtil.removeResult(FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_INSCRIPCIONUSERID,
					args);

				args = new Object[] {
						Long.valueOf(deportistaModelImpl.getInscripcionStatusByUserId())
					};

				FinderCacheUtil.removeResult(FINDER_PATH_COUNT_BY_INSCRIPCIONUSERID,
					args);
				FinderCacheUtil.removeResult(FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_INSCRIPCIONUSERID,
					args);
			}
		}

		EntityCacheUtil.putResult(DeportistaModelImpl.ENTITY_CACHE_ENABLED,
			DeportistaImpl.class, deportista.getPrimaryKey(), deportista);

		return deportista;
	}

	protected Deportista toUnwrappedModel(Deportista deportista) {
		if (deportista instanceof DeportistaImpl) {
			return deportista;
		}

		DeportistaImpl deportistaImpl = new DeportistaImpl();

		deportistaImpl.setNew(deportista.isNew());
		deportistaImpl.setPrimaryKey(deportista.getPrimaryKey());

		deportistaImpl.setDeportistaId(deportista.getDeportistaId());
		deportistaImpl.setDni(deportista.getDni());
		deportistaImpl.setNombres(deportista.getNombres());
		deportistaImpl.setApellido(deportista.getApellido());
		deportistaImpl.setEscuelaId(deportista.getEscuelaId());
		deportistaImpl.setFecha_nacimiento(deportista.getFecha_nacimiento());
		deportistaImpl.setMail(deportista.getMail());
		deportistaImpl.setNivel(deportista.getNivel());
		deportistaImpl.setCompanyId(deportista.getCompanyId());
		deportistaImpl.setGroupId(deportista.getGroupId());
		deportistaImpl.setInscripcionStatus(deportista.getInscripcionStatus());
		deportistaImpl.setInscripcionStatusPrevApproved(deportista.isInscripcionStatusPrevApproved());
		deportistaImpl.setInscripcionStatusByUserId(deportista.getInscripcionStatusByUserId());
		deportistaImpl.setInscripcionStatusByUserName(deportista.getInscripcionStatusByUserName());
		deportistaImpl.setInscripcionStatusDate(deportista.getInscripcionStatusDate());
		deportistaImpl.setInscripcionStatusComment(deportista.getInscripcionStatusComment());

		return deportistaImpl;
	}

	/**
	 * Returns the Deportista with the primary key or throws a {@link com.liferay.portal.NoSuchModelException} if it could not be found.
	 *
	 * @param primaryKey the primary key of the Deportista
	 * @return the Deportista
	 * @throws com.liferay.portal.NoSuchModelException if a Deportista with the primary key could not be found
	 * @throws SystemException if a system exception occurred
	 */
	@Override
	public Deportista findByPrimaryKey(Serializable primaryKey)
		throws NoSuchModelException, SystemException {
		return findByPrimaryKey(((Long)primaryKey).longValue());
	}

	/**
	 * Returns the Deportista with the primary key or throws a {@link slcu.NoSuchDeportistaException} if it could not be found.
	 *
	 * @param deportistaId the primary key of the Deportista
	 * @return the Deportista
	 * @throws slcu.NoSuchDeportistaException if a Deportista with the primary key could not be found
	 * @throws SystemException if a system exception occurred
	 */
	public Deportista findByPrimaryKey(long deportistaId)
		throws NoSuchDeportistaException, SystemException {
		Deportista deportista = fetchByPrimaryKey(deportistaId);

		if (deportista == null) {
			if (_log.isWarnEnabled()) {
				_log.warn(_NO_SUCH_ENTITY_WITH_PRIMARY_KEY + deportistaId);
			}

			throw new NoSuchDeportistaException(_NO_SUCH_ENTITY_WITH_PRIMARY_KEY +
				deportistaId);
		}

		return deportista;
	}

	/**
	 * Returns the Deportista with the primary key or returns <code>null</code> if it could not be found.
	 *
	 * @param primaryKey the primary key of the Deportista
	 * @return the Deportista, or <code>null</code> if a Deportista with the primary key could not be found
	 * @throws SystemException if a system exception occurred
	 */
	@Override
	public Deportista fetchByPrimaryKey(Serializable primaryKey)
		throws SystemException {
		return fetchByPrimaryKey(((Long)primaryKey).longValue());
	}

	/**
	 * Returns the Deportista with the primary key or returns <code>null</code> if it could not be found.
	 *
	 * @param deportistaId the primary key of the Deportista
	 * @return the Deportista, or <code>null</code> if a Deportista with the primary key could not be found
	 * @throws SystemException if a system exception occurred
	 */
	public Deportista fetchByPrimaryKey(long deportistaId)
		throws SystemException {
		Deportista deportista = (Deportista)EntityCacheUtil.getResult(DeportistaModelImpl.ENTITY_CACHE_ENABLED,
				DeportistaImpl.class, deportistaId);

		if (deportista == _nullDeportista) {
			return null;
		}

		if (deportista == null) {
			Session session = null;

			boolean hasException = false;

			try {
				session = openSession();

				deportista = (Deportista)session.get(DeportistaImpl.class,
						Long.valueOf(deportistaId));
			}
			catch (Exception e) {
				hasException = true;

				throw processException(e);
			}
			finally {
				if (deportista != null) {
					cacheResult(deportista);
				}
				else if (!hasException) {
					EntityCacheUtil.putResult(DeportistaModelImpl.ENTITY_CACHE_ENABLED,
						DeportistaImpl.class, deportistaId, _nullDeportista);
				}

				closeSession(session);
			}
		}

		return deportista;
	}

	/**
	 * Returns all the Deportistas where dni = &#63;.
	 *
	 * @param dni the dni
	 * @return the matching Deportistas
	 * @throws SystemException if a system exception occurred
	 */
	public List<Deportista> findByDNI(String dni) throws SystemException {
		return findByDNI(dni, QueryUtil.ALL_POS, QueryUtil.ALL_POS, null);
	}

	/**
	 * Returns a range of all the Deportistas where dni = &#63;.
	 *
	 * <p>
	 * Useful when paginating results. Returns a maximum of <code>end - start</code> instances. <code>start</code> and <code>end</code> are not primary keys, they are indexes in the result set. Thus, <code>0</code> refers to the first result in the set. Setting both <code>start</code> and <code>end</code> to {@link com.liferay.portal.kernel.dao.orm.QueryUtil#ALL_POS} will return the full result set.
	 * </p>
	 *
	 * @param dni the dni
	 * @param start the lower bound of the range of Deportistas
	 * @param end the upper bound of the range of Deportistas (not inclusive)
	 * @return the range of matching Deportistas
	 * @throws SystemException if a system exception occurred
	 */
	public List<Deportista> findByDNI(String dni, int start, int end)
		throws SystemException {
		return findByDNI(dni, start, end, null);
	}

	/**
	 * Returns an ordered range of all the Deportistas where dni = &#63;.
	 *
	 * <p>
	 * Useful when paginating results. Returns a maximum of <code>end - start</code> instances. <code>start</code> and <code>end</code> are not primary keys, they are indexes in the result set. Thus, <code>0</code> refers to the first result in the set. Setting both <code>start</code> and <code>end</code> to {@link com.liferay.portal.kernel.dao.orm.QueryUtil#ALL_POS} will return the full result set.
	 * </p>
	 *
	 * @param dni the dni
	 * @param start the lower bound of the range of Deportistas
	 * @param end the upper bound of the range of Deportistas (not inclusive)
	 * @param orderByComparator the comparator to order the results by (optionally <code>null</code>)
	 * @return the ordered range of matching Deportistas
	 * @throws SystemException if a system exception occurred
	 */
	public List<Deportista> findByDNI(String dni, int start, int end,
		OrderByComparator orderByComparator) throws SystemException {
		FinderPath finderPath = null;
		Object[] finderArgs = null;

		if ((start == QueryUtil.ALL_POS) && (end == QueryUtil.ALL_POS) &&
				(orderByComparator == null)) {
			finderPath = FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_DNI;
			finderArgs = new Object[] { dni };
		}
		else {
			finderPath = FINDER_PATH_WITH_PAGINATION_FIND_BY_DNI;
			finderArgs = new Object[] { dni, start, end, orderByComparator };
		}

		List<Deportista> list = (List<Deportista>)FinderCacheUtil.getResult(finderPath,
				finderArgs, this);

		if ((list != null) && !list.isEmpty()) {
			for (Deportista deportista : list) {
				if (!Validator.equals(dni, deportista.getDni())) {
					list = null;

					break;
				}
			}
		}

		if (list == null) {
			StringBundler query = null;

			if (orderByComparator != null) {
				query = new StringBundler(3 +
						(orderByComparator.getOrderByFields().length * 3));
			}
			else {
				query = new StringBundler(3);
			}

			query.append(_SQL_SELECT_DEPORTISTA_WHERE);

			if (dni == null) {
				query.append(_FINDER_COLUMN_DNI_DNI_1);
			}
			else {
				if (dni.equals(StringPool.BLANK)) {
					query.append(_FINDER_COLUMN_DNI_DNI_3);
				}
				else {
					query.append(_FINDER_COLUMN_DNI_DNI_2);
				}
			}

			if (orderByComparator != null) {
				appendOrderByComparator(query, _ORDER_BY_ENTITY_ALIAS,
					orderByComparator);
			}

			else {
				query.append(DeportistaModelImpl.ORDER_BY_JPQL);
			}

			String sql = query.toString();

			Session session = null;

			try {
				session = openSession();

				Query q = session.createQuery(sql);

				QueryPos qPos = QueryPos.getInstance(q);

				if (dni != null) {
					qPos.add(dni);
				}

				list = (List<Deportista>)QueryUtil.list(q, getDialect(), start,
						end);
			}
			catch (Exception e) {
				throw processException(e);
			}
			finally {
				if (list == null) {
					FinderCacheUtil.removeResult(finderPath, finderArgs);
				}
				else {
					cacheResult(list);

					FinderCacheUtil.putResult(finderPath, finderArgs, list);
				}

				closeSession(session);
			}
		}

		return list;
	}

	/**
	 * Returns the first Deportista in the ordered set where dni = &#63;.
	 *
	 * @param dni the dni
	 * @param orderByComparator the comparator to order the set by (optionally <code>null</code>)
	 * @return the first matching Deportista
	 * @throws slcu.NoSuchDeportistaException if a matching Deportista could not be found
	 * @throws SystemException if a system exception occurred
	 */
	public Deportista findByDNI_First(String dni,
		OrderByComparator orderByComparator)
		throws NoSuchDeportistaException, SystemException {
		Deportista deportista = fetchByDNI_First(dni, orderByComparator);

		if (deportista != null) {
			return deportista;
		}

		StringBundler msg = new StringBundler(4);

		msg.append(_NO_SUCH_ENTITY_WITH_KEY);

		msg.append("dni=");
		msg.append(dni);

		msg.append(StringPool.CLOSE_CURLY_BRACE);

		throw new NoSuchDeportistaException(msg.toString());
	}

	/**
	 * Returns the first Deportista in the ordered set where dni = &#63;.
	 *
	 * @param dni the dni
	 * @param orderByComparator the comparator to order the set by (optionally <code>null</code>)
	 * @return the first matching Deportista, or <code>null</code> if a matching Deportista could not be found
	 * @throws SystemException if a system exception occurred
	 */
	public Deportista fetchByDNI_First(String dni,
		OrderByComparator orderByComparator) throws SystemException {
		List<Deportista> list = findByDNI(dni, 0, 1, orderByComparator);

		if (!list.isEmpty()) {
			return list.get(0);
		}

		return null;
	}

	/**
	 * Returns the last Deportista in the ordered set where dni = &#63;.
	 *
	 * @param dni the dni
	 * @param orderByComparator the comparator to order the set by (optionally <code>null</code>)
	 * @return the last matching Deportista
	 * @throws slcu.NoSuchDeportistaException if a matching Deportista could not be found
	 * @throws SystemException if a system exception occurred
	 */
	public Deportista findByDNI_Last(String dni,
		OrderByComparator orderByComparator)
		throws NoSuchDeportistaException, SystemException {
		Deportista deportista = fetchByDNI_Last(dni, orderByComparator);

		if (deportista != null) {
			return deportista;
		}

		StringBundler msg = new StringBundler(4);

		msg.append(_NO_SUCH_ENTITY_WITH_KEY);

		msg.append("dni=");
		msg.append(dni);

		msg.append(StringPool.CLOSE_CURLY_BRACE);

		throw new NoSuchDeportistaException(msg.toString());
	}

	/**
	 * Returns the last Deportista in the ordered set where dni = &#63;.
	 *
	 * @param dni the dni
	 * @param orderByComparator the comparator to order the set by (optionally <code>null</code>)
	 * @return the last matching Deportista, or <code>null</code> if a matching Deportista could not be found
	 * @throws SystemException if a system exception occurred
	 */
	public Deportista fetchByDNI_Last(String dni,
		OrderByComparator orderByComparator) throws SystemException {
		int count = countByDNI(dni);

		List<Deportista> list = findByDNI(dni, count - 1, count,
				orderByComparator);

		if (!list.isEmpty()) {
			return list.get(0);
		}

		return null;
	}

	/**
	 * Returns the Deportistas before and after the current Deportista in the ordered set where dni = &#63;.
	 *
	 * @param deportistaId the primary key of the current Deportista
	 * @param dni the dni
	 * @param orderByComparator the comparator to order the set by (optionally <code>null</code>)
	 * @return the previous, current, and next Deportista
	 * @throws slcu.NoSuchDeportistaException if a Deportista with the primary key could not be found
	 * @throws SystemException if a system exception occurred
	 */
	public Deportista[] findByDNI_PrevAndNext(long deportistaId, String dni,
		OrderByComparator orderByComparator)
		throws NoSuchDeportistaException, SystemException {
		Deportista deportista = findByPrimaryKey(deportistaId);

		Session session = null;

		try {
			session = openSession();

			Deportista[] array = new DeportistaImpl[3];

			array[0] = getByDNI_PrevAndNext(session, deportista, dni,
					orderByComparator, true);

			array[1] = deportista;

			array[2] = getByDNI_PrevAndNext(session, deportista, dni,
					orderByComparator, false);

			return array;
		}
		catch (Exception e) {
			throw processException(e);
		}
		finally {
			closeSession(session);
		}
	}

	protected Deportista getByDNI_PrevAndNext(Session session,
		Deportista deportista, String dni, OrderByComparator orderByComparator,
		boolean previous) {
		StringBundler query = null;

		if (orderByComparator != null) {
			query = new StringBundler(6 +
					(orderByComparator.getOrderByFields().length * 6));
		}
		else {
			query = new StringBundler(3);
		}

		query.append(_SQL_SELECT_DEPORTISTA_WHERE);

		if (dni == null) {
			query.append(_FINDER_COLUMN_DNI_DNI_1);
		}
		else {
			if (dni.equals(StringPool.BLANK)) {
				query.append(_FINDER_COLUMN_DNI_DNI_3);
			}
			else {
				query.append(_FINDER_COLUMN_DNI_DNI_2);
			}
		}

		if (orderByComparator != null) {
			String[] orderByConditionFields = orderByComparator.getOrderByConditionFields();

			if (orderByConditionFields.length > 0) {
				query.append(WHERE_AND);
			}

			for (int i = 0; i < orderByConditionFields.length; i++) {
				query.append(_ORDER_BY_ENTITY_ALIAS);
				query.append(orderByConditionFields[i]);

				if ((i + 1) < orderByConditionFields.length) {
					if (orderByComparator.isAscending() ^ previous) {
						query.append(WHERE_GREATER_THAN_HAS_NEXT);
					}
					else {
						query.append(WHERE_LESSER_THAN_HAS_NEXT);
					}
				}
				else {
					if (orderByComparator.isAscending() ^ previous) {
						query.append(WHERE_GREATER_THAN);
					}
					else {
						query.append(WHERE_LESSER_THAN);
					}
				}
			}

			query.append(ORDER_BY_CLAUSE);

			String[] orderByFields = orderByComparator.getOrderByFields();

			for (int i = 0; i < orderByFields.length; i++) {
				query.append(_ORDER_BY_ENTITY_ALIAS);
				query.append(orderByFields[i]);

				if ((i + 1) < orderByFields.length) {
					if (orderByComparator.isAscending() ^ previous) {
						query.append(ORDER_BY_ASC_HAS_NEXT);
					}
					else {
						query.append(ORDER_BY_DESC_HAS_NEXT);
					}
				}
				else {
					if (orderByComparator.isAscending() ^ previous) {
						query.append(ORDER_BY_ASC);
					}
					else {
						query.append(ORDER_BY_DESC);
					}
				}
			}
		}

		else {
			query.append(DeportistaModelImpl.ORDER_BY_JPQL);
		}

		String sql = query.toString();

		Query q = session.createQuery(sql);

		q.setFirstResult(0);
		q.setMaxResults(2);

		QueryPos qPos = QueryPos.getInstance(q);

		if (dni != null) {
			qPos.add(dni);
		}

		if (orderByComparator != null) {
			Object[] values = orderByComparator.getOrderByConditionValues(deportista);

			for (Object value : values) {
				qPos.add(value);
			}
		}

		List<Deportista> list = q.list();

		if (list.size() == 2) {
			return list.get(1);
		}
		else {
			return null;
		}
	}

	/**
	 * Returns all the Deportistas where inscripcionStatusByUserId = &#63;.
	 *
	 * @param inscripcionStatusByUserId the inscripcion status by user ID
	 * @return the matching Deportistas
	 * @throws SystemException if a system exception occurred
	 */
	public List<Deportista> findByinscripcionUserId(
		long inscripcionStatusByUserId) throws SystemException {
		return findByinscripcionUserId(inscripcionStatusByUserId,
			QueryUtil.ALL_POS, QueryUtil.ALL_POS, null);
	}

	/**
	 * Returns a range of all the Deportistas where inscripcionStatusByUserId = &#63;.
	 *
	 * <p>
	 * Useful when paginating results. Returns a maximum of <code>end - start</code> instances. <code>start</code> and <code>end</code> are not primary keys, they are indexes in the result set. Thus, <code>0</code> refers to the first result in the set. Setting both <code>start</code> and <code>end</code> to {@link com.liferay.portal.kernel.dao.orm.QueryUtil#ALL_POS} will return the full result set.
	 * </p>
	 *
	 * @param inscripcionStatusByUserId the inscripcion status by user ID
	 * @param start the lower bound of the range of Deportistas
	 * @param end the upper bound of the range of Deportistas (not inclusive)
	 * @return the range of matching Deportistas
	 * @throws SystemException if a system exception occurred
	 */
	public List<Deportista> findByinscripcionUserId(
		long inscripcionStatusByUserId, int start, int end)
		throws SystemException {
		return findByinscripcionUserId(inscripcionStatusByUserId, start, end,
			null);
	}

	/**
	 * Returns an ordered range of all the Deportistas where inscripcionStatusByUserId = &#63;.
	 *
	 * <p>
	 * Useful when paginating results. Returns a maximum of <code>end - start</code> instances. <code>start</code> and <code>end</code> are not primary keys, they are indexes in the result set. Thus, <code>0</code> refers to the first result in the set. Setting both <code>start</code> and <code>end</code> to {@link com.liferay.portal.kernel.dao.orm.QueryUtil#ALL_POS} will return the full result set.
	 * </p>
	 *
	 * @param inscripcionStatusByUserId the inscripcion status by user ID
	 * @param start the lower bound of the range of Deportistas
	 * @param end the upper bound of the range of Deportistas (not inclusive)
	 * @param orderByComparator the comparator to order the results by (optionally <code>null</code>)
	 * @return the ordered range of matching Deportistas
	 * @throws SystemException if a system exception occurred
	 */
	public List<Deportista> findByinscripcionUserId(
		long inscripcionStatusByUserId, int start, int end,
		OrderByComparator orderByComparator) throws SystemException {
		FinderPath finderPath = null;
		Object[] finderArgs = null;

		if ((start == QueryUtil.ALL_POS) && (end == QueryUtil.ALL_POS) &&
				(orderByComparator == null)) {
			finderPath = FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_INSCRIPCIONUSERID;
			finderArgs = new Object[] { inscripcionStatusByUserId };
		}
		else {
			finderPath = FINDER_PATH_WITH_PAGINATION_FIND_BY_INSCRIPCIONUSERID;
			finderArgs = new Object[] {
					inscripcionStatusByUserId,
					
					start, end, orderByComparator
				};
		}

		List<Deportista> list = (List<Deportista>)FinderCacheUtil.getResult(finderPath,
				finderArgs, this);

		if ((list != null) && !list.isEmpty()) {
			for (Deportista deportista : list) {
				if ((inscripcionStatusByUserId != deportista.getInscripcionStatusByUserId())) {
					list = null;

					break;
				}
			}
		}

		if (list == null) {
			StringBundler query = null;

			if (orderByComparator != null) {
				query = new StringBundler(3 +
						(orderByComparator.getOrderByFields().length * 3));
			}
			else {
				query = new StringBundler(3);
			}

			query.append(_SQL_SELECT_DEPORTISTA_WHERE);

			query.append(_FINDER_COLUMN_INSCRIPCIONUSERID_INSCRIPCIONSTATUSBYUSERID_2);

			if (orderByComparator != null) {
				appendOrderByComparator(query, _ORDER_BY_ENTITY_ALIAS,
					orderByComparator);
			}

			else {
				query.append(DeportistaModelImpl.ORDER_BY_JPQL);
			}

			String sql = query.toString();

			Session session = null;

			try {
				session = openSession();

				Query q = session.createQuery(sql);

				QueryPos qPos = QueryPos.getInstance(q);

				qPos.add(inscripcionStatusByUserId);

				list = (List<Deportista>)QueryUtil.list(q, getDialect(), start,
						end);
			}
			catch (Exception e) {
				throw processException(e);
			}
			finally {
				if (list == null) {
					FinderCacheUtil.removeResult(finderPath, finderArgs);
				}
				else {
					cacheResult(list);

					FinderCacheUtil.putResult(finderPath, finderArgs, list);
				}

				closeSession(session);
			}
		}

		return list;
	}

	/**
	 * Returns the first Deportista in the ordered set where inscripcionStatusByUserId = &#63;.
	 *
	 * @param inscripcionStatusByUserId the inscripcion status by user ID
	 * @param orderByComparator the comparator to order the set by (optionally <code>null</code>)
	 * @return the first matching Deportista
	 * @throws slcu.NoSuchDeportistaException if a matching Deportista could not be found
	 * @throws SystemException if a system exception occurred
	 */
	public Deportista findByinscripcionUserId_First(
		long inscripcionStatusByUserId, OrderByComparator orderByComparator)
		throws NoSuchDeportistaException, SystemException {
		Deportista deportista = fetchByinscripcionUserId_First(inscripcionStatusByUserId,
				orderByComparator);

		if (deportista != null) {
			return deportista;
		}

		StringBundler msg = new StringBundler(4);

		msg.append(_NO_SUCH_ENTITY_WITH_KEY);

		msg.append("inscripcionStatusByUserId=");
		msg.append(inscripcionStatusByUserId);

		msg.append(StringPool.CLOSE_CURLY_BRACE);

		throw new NoSuchDeportistaException(msg.toString());
	}

	/**
	 * Returns the first Deportista in the ordered set where inscripcionStatusByUserId = &#63;.
	 *
	 * @param inscripcionStatusByUserId the inscripcion status by user ID
	 * @param orderByComparator the comparator to order the set by (optionally <code>null</code>)
	 * @return the first matching Deportista, or <code>null</code> if a matching Deportista could not be found
	 * @throws SystemException if a system exception occurred
	 */
	public Deportista fetchByinscripcionUserId_First(
		long inscripcionStatusByUserId, OrderByComparator orderByComparator)
		throws SystemException {
		List<Deportista> list = findByinscripcionUserId(inscripcionStatusByUserId,
				0, 1, orderByComparator);

		if (!list.isEmpty()) {
			return list.get(0);
		}

		return null;
	}

	/**
	 * Returns the last Deportista in the ordered set where inscripcionStatusByUserId = &#63;.
	 *
	 * @param inscripcionStatusByUserId the inscripcion status by user ID
	 * @param orderByComparator the comparator to order the set by (optionally <code>null</code>)
	 * @return the last matching Deportista
	 * @throws slcu.NoSuchDeportistaException if a matching Deportista could not be found
	 * @throws SystemException if a system exception occurred
	 */
	public Deportista findByinscripcionUserId_Last(
		long inscripcionStatusByUserId, OrderByComparator orderByComparator)
		throws NoSuchDeportistaException, SystemException {
		Deportista deportista = fetchByinscripcionUserId_Last(inscripcionStatusByUserId,
				orderByComparator);

		if (deportista != null) {
			return deportista;
		}

		StringBundler msg = new StringBundler(4);

		msg.append(_NO_SUCH_ENTITY_WITH_KEY);

		msg.append("inscripcionStatusByUserId=");
		msg.append(inscripcionStatusByUserId);

		msg.append(StringPool.CLOSE_CURLY_BRACE);

		throw new NoSuchDeportistaException(msg.toString());
	}

	/**
	 * Returns the last Deportista in the ordered set where inscripcionStatusByUserId = &#63;.
	 *
	 * @param inscripcionStatusByUserId the inscripcion status by user ID
	 * @param orderByComparator the comparator to order the set by (optionally <code>null</code>)
	 * @return the last matching Deportista, or <code>null</code> if a matching Deportista could not be found
	 * @throws SystemException if a system exception occurred
	 */
	public Deportista fetchByinscripcionUserId_Last(
		long inscripcionStatusByUserId, OrderByComparator orderByComparator)
		throws SystemException {
		int count = countByinscripcionUserId(inscripcionStatusByUserId);

		List<Deportista> list = findByinscripcionUserId(inscripcionStatusByUserId,
				count - 1, count, orderByComparator);

		if (!list.isEmpty()) {
			return list.get(0);
		}

		return null;
	}

	/**
	 * Returns the Deportistas before and after the current Deportista in the ordered set where inscripcionStatusByUserId = &#63;.
	 *
	 * @param deportistaId the primary key of the current Deportista
	 * @param inscripcionStatusByUserId the inscripcion status by user ID
	 * @param orderByComparator the comparator to order the set by (optionally <code>null</code>)
	 * @return the previous, current, and next Deportista
	 * @throws slcu.NoSuchDeportistaException if a Deportista with the primary key could not be found
	 * @throws SystemException if a system exception occurred
	 */
	public Deportista[] findByinscripcionUserId_PrevAndNext(long deportistaId,
		long inscripcionStatusByUserId, OrderByComparator orderByComparator)
		throws NoSuchDeportistaException, SystemException {
		Deportista deportista = findByPrimaryKey(deportistaId);

		Session session = null;

		try {
			session = openSession();

			Deportista[] array = new DeportistaImpl[3];

			array[0] = getByinscripcionUserId_PrevAndNext(session, deportista,
					inscripcionStatusByUserId, orderByComparator, true);

			array[1] = deportista;

			array[2] = getByinscripcionUserId_PrevAndNext(session, deportista,
					inscripcionStatusByUserId, orderByComparator, false);

			return array;
		}
		catch (Exception e) {
			throw processException(e);
		}
		finally {
			closeSession(session);
		}
	}

	protected Deportista getByinscripcionUserId_PrevAndNext(Session session,
		Deportista deportista, long inscripcionStatusByUserId,
		OrderByComparator orderByComparator, boolean previous) {
		StringBundler query = null;

		if (orderByComparator != null) {
			query = new StringBundler(6 +
					(orderByComparator.getOrderByFields().length * 6));
		}
		else {
			query = new StringBundler(3);
		}

		query.append(_SQL_SELECT_DEPORTISTA_WHERE);

		query.append(_FINDER_COLUMN_INSCRIPCIONUSERID_INSCRIPCIONSTATUSBYUSERID_2);

		if (orderByComparator != null) {
			String[] orderByConditionFields = orderByComparator.getOrderByConditionFields();

			if (orderByConditionFields.length > 0) {
				query.append(WHERE_AND);
			}

			for (int i = 0; i < orderByConditionFields.length; i++) {
				query.append(_ORDER_BY_ENTITY_ALIAS);
				query.append(orderByConditionFields[i]);

				if ((i + 1) < orderByConditionFields.length) {
					if (orderByComparator.isAscending() ^ previous) {
						query.append(WHERE_GREATER_THAN_HAS_NEXT);
					}
					else {
						query.append(WHERE_LESSER_THAN_HAS_NEXT);
					}
				}
				else {
					if (orderByComparator.isAscending() ^ previous) {
						query.append(WHERE_GREATER_THAN);
					}
					else {
						query.append(WHERE_LESSER_THAN);
					}
				}
			}

			query.append(ORDER_BY_CLAUSE);

			String[] orderByFields = orderByComparator.getOrderByFields();

			for (int i = 0; i < orderByFields.length; i++) {
				query.append(_ORDER_BY_ENTITY_ALIAS);
				query.append(orderByFields[i]);

				if ((i + 1) < orderByFields.length) {
					if (orderByComparator.isAscending() ^ previous) {
						query.append(ORDER_BY_ASC_HAS_NEXT);
					}
					else {
						query.append(ORDER_BY_DESC_HAS_NEXT);
					}
				}
				else {
					if (orderByComparator.isAscending() ^ previous) {
						query.append(ORDER_BY_ASC);
					}
					else {
						query.append(ORDER_BY_DESC);
					}
				}
			}
		}

		else {
			query.append(DeportistaModelImpl.ORDER_BY_JPQL);
		}

		String sql = query.toString();

		Query q = session.createQuery(sql);

		q.setFirstResult(0);
		q.setMaxResults(2);

		QueryPos qPos = QueryPos.getInstance(q);

		qPos.add(inscripcionStatusByUserId);

		if (orderByComparator != null) {
			Object[] values = orderByComparator.getOrderByConditionValues(deportista);

			for (Object value : values) {
				qPos.add(value);
			}
		}

		List<Deportista> list = q.list();

		if (list.size() == 2) {
			return list.get(1);
		}
		else {
			return null;
		}
	}

	/**
	 * Returns all the Deportistas.
	 *
	 * @return the Deportistas
	 * @throws SystemException if a system exception occurred
	 */
	public List<Deportista> findAll() throws SystemException {
		return findAll(QueryUtil.ALL_POS, QueryUtil.ALL_POS, null);
	}

	/**
	 * Returns a range of all the Deportistas.
	 *
	 * <p>
	 * Useful when paginating results. Returns a maximum of <code>end - start</code> instances. <code>start</code> and <code>end</code> are not primary keys, they are indexes in the result set. Thus, <code>0</code> refers to the first result in the set. Setting both <code>start</code> and <code>end</code> to {@link com.liferay.portal.kernel.dao.orm.QueryUtil#ALL_POS} will return the full result set.
	 * </p>
	 *
	 * @param start the lower bound of the range of Deportistas
	 * @param end the upper bound of the range of Deportistas (not inclusive)
	 * @return the range of Deportistas
	 * @throws SystemException if a system exception occurred
	 */
	public List<Deportista> findAll(int start, int end)
		throws SystemException {
		return findAll(start, end, null);
	}

	/**
	 * Returns an ordered range of all the Deportistas.
	 *
	 * <p>
	 * Useful when paginating results. Returns a maximum of <code>end - start</code> instances. <code>start</code> and <code>end</code> are not primary keys, they are indexes in the result set. Thus, <code>0</code> refers to the first result in the set. Setting both <code>start</code> and <code>end</code> to {@link com.liferay.portal.kernel.dao.orm.QueryUtil#ALL_POS} will return the full result set.
	 * </p>
	 *
	 * @param start the lower bound of the range of Deportistas
	 * @param end the upper bound of the range of Deportistas (not inclusive)
	 * @param orderByComparator the comparator to order the results by (optionally <code>null</code>)
	 * @return the ordered range of Deportistas
	 * @throws SystemException if a system exception occurred
	 */
	public List<Deportista> findAll(int start, int end,
		OrderByComparator orderByComparator) throws SystemException {
		FinderPath finderPath = null;
		Object[] finderArgs = new Object[] { start, end, orderByComparator };

		if ((start == QueryUtil.ALL_POS) && (end == QueryUtil.ALL_POS) &&
				(orderByComparator == null)) {
			finderPath = FINDER_PATH_WITHOUT_PAGINATION_FIND_ALL;
			finderArgs = FINDER_ARGS_EMPTY;
		}
		else {
			finderPath = FINDER_PATH_WITH_PAGINATION_FIND_ALL;
			finderArgs = new Object[] { start, end, orderByComparator };
		}

		List<Deportista> list = (List<Deportista>)FinderCacheUtil.getResult(finderPath,
				finderArgs, this);

		if (list == null) {
			StringBundler query = null;
			String sql = null;

			if (orderByComparator != null) {
				query = new StringBundler(2 +
						(orderByComparator.getOrderByFields().length * 3));

				query.append(_SQL_SELECT_DEPORTISTA);

				appendOrderByComparator(query, _ORDER_BY_ENTITY_ALIAS,
					orderByComparator);

				sql = query.toString();
			}
			else {
				sql = _SQL_SELECT_DEPORTISTA.concat(DeportistaModelImpl.ORDER_BY_JPQL);
			}

			Session session = null;

			try {
				session = openSession();

				Query q = session.createQuery(sql);

				if (orderByComparator == null) {
					list = (List<Deportista>)QueryUtil.list(q, getDialect(),
							start, end, false);

					Collections.sort(list);
				}
				else {
					list = (List<Deportista>)QueryUtil.list(q, getDialect(),
							start, end);
				}
			}
			catch (Exception e) {
				throw processException(e);
			}
			finally {
				if (list == null) {
					FinderCacheUtil.removeResult(finderPath, finderArgs);
				}
				else {
					cacheResult(list);

					FinderCacheUtil.putResult(finderPath, finderArgs, list);
				}

				closeSession(session);
			}
		}

		return list;
	}

	/**
	 * Removes all the Deportistas where dni = &#63; from the database.
	 *
	 * @param dni the dni
	 * @throws SystemException if a system exception occurred
	 */
	public void removeByDNI(String dni) throws SystemException {
		for (Deportista deportista : findByDNI(dni)) {
			remove(deportista);
		}
	}

	/**
	 * Removes all the Deportistas where inscripcionStatusByUserId = &#63; from the database.
	 *
	 * @param inscripcionStatusByUserId the inscripcion status by user ID
	 * @throws SystemException if a system exception occurred
	 */
	public void removeByinscripcionUserId(long inscripcionStatusByUserId)
		throws SystemException {
		for (Deportista deportista : findByinscripcionUserId(
				inscripcionStatusByUserId)) {
			remove(deportista);
		}
	}

	/**
	 * Removes all the Deportistas from the database.
	 *
	 * @throws SystemException if a system exception occurred
	 */
	public void removeAll() throws SystemException {
		for (Deportista deportista : findAll()) {
			remove(deportista);
		}
	}

	/**
	 * Returns the number of Deportistas where dni = &#63;.
	 *
	 * @param dni the dni
	 * @return the number of matching Deportistas
	 * @throws SystemException if a system exception occurred
	 */
	public int countByDNI(String dni) throws SystemException {
		Object[] finderArgs = new Object[] { dni };

		Long count = (Long)FinderCacheUtil.getResult(FINDER_PATH_COUNT_BY_DNI,
				finderArgs, this);

		if (count == null) {
			StringBundler query = new StringBundler(2);

			query.append(_SQL_COUNT_DEPORTISTA_WHERE);

			if (dni == null) {
				query.append(_FINDER_COLUMN_DNI_DNI_1);
			}
			else {
				if (dni.equals(StringPool.BLANK)) {
					query.append(_FINDER_COLUMN_DNI_DNI_3);
				}
				else {
					query.append(_FINDER_COLUMN_DNI_DNI_2);
				}
			}

			String sql = query.toString();

			Session session = null;

			try {
				session = openSession();

				Query q = session.createQuery(sql);

				QueryPos qPos = QueryPos.getInstance(q);

				if (dni != null) {
					qPos.add(dni);
				}

				count = (Long)q.uniqueResult();
			}
			catch (Exception e) {
				throw processException(e);
			}
			finally {
				if (count == null) {
					count = Long.valueOf(0);
				}

				FinderCacheUtil.putResult(FINDER_PATH_COUNT_BY_DNI, finderArgs,
					count);

				closeSession(session);
			}
		}

		return count.intValue();
	}

	/**
	 * Returns the number of Deportistas where inscripcionStatusByUserId = &#63;.
	 *
	 * @param inscripcionStatusByUserId the inscripcion status by user ID
	 * @return the number of matching Deportistas
	 * @throws SystemException if a system exception occurred
	 */
	public int countByinscripcionUserId(long inscripcionStatusByUserId)
		throws SystemException {
		Object[] finderArgs = new Object[] { inscripcionStatusByUserId };

		Long count = (Long)FinderCacheUtil.getResult(FINDER_PATH_COUNT_BY_INSCRIPCIONUSERID,
				finderArgs, this);

		if (count == null) {
			StringBundler query = new StringBundler(2);

			query.append(_SQL_COUNT_DEPORTISTA_WHERE);

			query.append(_FINDER_COLUMN_INSCRIPCIONUSERID_INSCRIPCIONSTATUSBYUSERID_2);

			String sql = query.toString();

			Session session = null;

			try {
				session = openSession();

				Query q = session.createQuery(sql);

				QueryPos qPos = QueryPos.getInstance(q);

				qPos.add(inscripcionStatusByUserId);

				count = (Long)q.uniqueResult();
			}
			catch (Exception e) {
				throw processException(e);
			}
			finally {
				if (count == null) {
					count = Long.valueOf(0);
				}

				FinderCacheUtil.putResult(FINDER_PATH_COUNT_BY_INSCRIPCIONUSERID,
					finderArgs, count);

				closeSession(session);
			}
		}

		return count.intValue();
	}

	/**
	 * Returns the number of Deportistas.
	 *
	 * @return the number of Deportistas
	 * @throws SystemException if a system exception occurred
	 */
	public int countAll() throws SystemException {
		Long count = (Long)FinderCacheUtil.getResult(FINDER_PATH_COUNT_ALL,
				FINDER_ARGS_EMPTY, this);

		if (count == null) {
			Session session = null;

			try {
				session = openSession();

				Query q = session.createQuery(_SQL_COUNT_DEPORTISTA);

				count = (Long)q.uniqueResult();
			}
			catch (Exception e) {
				throw processException(e);
			}
			finally {
				if (count == null) {
					count = Long.valueOf(0);
				}

				FinderCacheUtil.putResult(FINDER_PATH_COUNT_ALL,
					FINDER_ARGS_EMPTY, count);

				closeSession(session);
			}
		}

		return count.intValue();
	}

	/**
	 * Returns all the Equipos associated with the Deportista.
	 *
	 * @param pk the primary key of the Deportista
	 * @return the Equipos associated with the Deportista
	 * @throws SystemException if a system exception occurred
	 */
	public List<slcu.model.Equipo> getEquipos(long pk)
		throws SystemException {
		return getEquipos(pk, QueryUtil.ALL_POS, QueryUtil.ALL_POS);
	}

	/**
	 * Returns a range of all the Equipos associated with the Deportista.
	 *
	 * <p>
	 * Useful when paginating results. Returns a maximum of <code>end - start</code> instances. <code>start</code> and <code>end</code> are not primary keys, they are indexes in the result set. Thus, <code>0</code> refers to the first result in the set. Setting both <code>start</code> and <code>end</code> to {@link com.liferay.portal.kernel.dao.orm.QueryUtil#ALL_POS} will return the full result set.
	 * </p>
	 *
	 * @param pk the primary key of the Deportista
	 * @param start the lower bound of the range of Deportistas
	 * @param end the upper bound of the range of Deportistas (not inclusive)
	 * @return the range of Equipos associated with the Deportista
	 * @throws SystemException if a system exception occurred
	 */
	public List<slcu.model.Equipo> getEquipos(long pk, int start, int end)
		throws SystemException {
		return getEquipos(pk, start, end, null);
	}

	public static final FinderPath FINDER_PATH_GET_EQUIPOS = new FinderPath(slcu.model.impl.EquipoModelImpl.ENTITY_CACHE_ENABLED,
			slcu.model.impl.EquipoModelImpl.FINDER_CACHE_ENABLED,
			slcu.model.impl.EquipoImpl.class,
			slcu.service.persistence.EquipoPersistenceImpl.FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION,
			"getEquipos",
			new String[] {
				Long.class.getName(), "java.lang.Integer", "java.lang.Integer",
				"com.liferay.portal.kernel.util.OrderByComparator"
			});

	static {
		FINDER_PATH_GET_EQUIPOS.setCacheKeyGeneratorCacheName(null);
	}

	/**
	 * Returns an ordered range of all the Equipos associated with the Deportista.
	 *
	 * <p>
	 * Useful when paginating results. Returns a maximum of <code>end - start</code> instances. <code>start</code> and <code>end</code> are not primary keys, they are indexes in the result set. Thus, <code>0</code> refers to the first result in the set. Setting both <code>start</code> and <code>end</code> to {@link com.liferay.portal.kernel.dao.orm.QueryUtil#ALL_POS} will return the full result set.
	 * </p>
	 *
	 * @param pk the primary key of the Deportista
	 * @param start the lower bound of the range of Deportistas
	 * @param end the upper bound of the range of Deportistas (not inclusive)
	 * @param orderByComparator the comparator to order the results by (optionally <code>null</code>)
	 * @return the ordered range of Equipos associated with the Deportista
	 * @throws SystemException if a system exception occurred
	 */
	public List<slcu.model.Equipo> getEquipos(long pk, int start, int end,
		OrderByComparator orderByComparator) throws SystemException {
		Object[] finderArgs = new Object[] { pk, start, end, orderByComparator };

		List<slcu.model.Equipo> list = (List<slcu.model.Equipo>)FinderCacheUtil.getResult(FINDER_PATH_GET_EQUIPOS,
				finderArgs, this);

		if (list == null) {
			Session session = null;

			try {
				session = openSession();

				String sql = null;

				if (orderByComparator != null) {
					sql = _SQL_GETEQUIPOS.concat(ORDER_BY_CLAUSE)
										 .concat(orderByComparator.getOrderBy());
				}
				else {
					sql = _SQL_GETEQUIPOS;
				}

				SQLQuery q = session.createSQLQuery(sql);

				q.addEntity("SLCU_Equipos", slcu.model.impl.EquipoImpl.class);

				QueryPos qPos = QueryPos.getInstance(q);

				qPos.add(pk);

				list = (List<slcu.model.Equipo>)QueryUtil.list(q, getDialect(),
						start, end);
			}
			catch (Exception e) {
				throw processException(e);
			}
			finally {
				if (list == null) {
					FinderCacheUtil.removeResult(FINDER_PATH_GET_EQUIPOS,
						finderArgs);
				}
				else {
					equipoPersistence.cacheResult(list);

					FinderCacheUtil.putResult(FINDER_PATH_GET_EQUIPOS,
						finderArgs, list);
				}

				closeSession(session);
			}
		}

		return list;
	}

	public static final FinderPath FINDER_PATH_GET_EQUIPOS_SIZE = new FinderPath(slcu.model.impl.EquipoModelImpl.ENTITY_CACHE_ENABLED,
			slcu.model.impl.EquipoModelImpl.FINDER_CACHE_ENABLED,
			slcu.model.impl.EquipoImpl.class,
			slcu.service.persistence.EquipoPersistenceImpl.FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION,
			"getEquiposSize", new String[] { Long.class.getName() });

	static {
		FINDER_PATH_GET_EQUIPOS_SIZE.setCacheKeyGeneratorCacheName(null);
	}

	/**
	 * Returns the number of Equipos associated with the Deportista.
	 *
	 * @param pk the primary key of the Deportista
	 * @return the number of Equipos associated with the Deportista
	 * @throws SystemException if a system exception occurred
	 */
	public int getEquiposSize(long pk) throws SystemException {
		Object[] finderArgs = new Object[] { pk };

		Long count = (Long)FinderCacheUtil.getResult(FINDER_PATH_GET_EQUIPOS_SIZE,
				finderArgs, this);

		if (count == null) {
			Session session = null;

			try {
				session = openSession();

				SQLQuery q = session.createSQLQuery(_SQL_GETEQUIPOSSIZE);

				q.addScalar(COUNT_COLUMN_NAME,
					com.liferay.portal.kernel.dao.orm.Type.LONG);

				QueryPos qPos = QueryPos.getInstance(q);

				qPos.add(pk);

				count = (Long)q.uniqueResult();
			}
			catch (Exception e) {
				throw processException(e);
			}
			finally {
				if (count == null) {
					count = Long.valueOf(0);
				}

				FinderCacheUtil.putResult(FINDER_PATH_GET_EQUIPOS_SIZE,
					finderArgs, count);

				closeSession(session);
			}
		}

		return count.intValue();
	}

	public static final FinderPath FINDER_PATH_CONTAINS_EQUIPO = new FinderPath(slcu.model.impl.EquipoModelImpl.ENTITY_CACHE_ENABLED,
			slcu.model.impl.EquipoModelImpl.FINDER_CACHE_ENABLED,
			slcu.model.impl.EquipoImpl.class,
			slcu.service.persistence.EquipoPersistenceImpl.FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION,
			"containsEquipo",
			new String[] { Long.class.getName(), Long.class.getName() });

	/**
	 * Returns <code>true</code> if the Equipo is associated with the Deportista.
	 *
	 * @param pk the primary key of the Deportista
	 * @param equipoPK the primary key of the Equipo
	 * @return <code>true</code> if the Equipo is associated with the Deportista; <code>false</code> otherwise
	 * @throws SystemException if a system exception occurred
	 */
	public boolean containsEquipo(long pk, long equipoPK)
		throws SystemException {
		Object[] finderArgs = new Object[] { pk, equipoPK };

		Boolean value = (Boolean)FinderCacheUtil.getResult(FINDER_PATH_CONTAINS_EQUIPO,
				finderArgs, this);

		if (value == null) {
			try {
				value = Boolean.valueOf(containsEquipo.contains(pk, equipoPK));
			}
			catch (Exception e) {
				throw processException(e);
			}
			finally {
				if (value == null) {
					value = Boolean.FALSE;
				}

				FinderCacheUtil.putResult(FINDER_PATH_CONTAINS_EQUIPO,
					finderArgs, value);
			}
		}

		return value.booleanValue();
	}

	/**
	 * Returns <code>true</code> if the Deportista has any Equipos associated with it.
	 *
	 * @param pk the primary key of the Deportista to check for associations with Equipos
	 * @return <code>true</code> if the Deportista has any Equipos associated with it; <code>false</code> otherwise
	 * @throws SystemException if a system exception occurred
	 */
	public boolean containsEquipos(long pk) throws SystemException {
		if (getEquiposSize(pk) > 0) {
			return true;
		}
		else {
			return false;
		}
	}

	/**
	 * Returns all the NotificacionRechazos associated with the Deportista.
	 *
	 * @param pk the primary key of the Deportista
	 * @return the NotificacionRechazos associated with the Deportista
	 * @throws SystemException if a system exception occurred
	 */
	public List<slcu.model.NotificacionRechazo> getNotificacionRechazos(long pk)
		throws SystemException {
		return getNotificacionRechazos(pk, QueryUtil.ALL_POS, QueryUtil.ALL_POS);
	}

	/**
	 * Returns a range of all the NotificacionRechazos associated with the Deportista.
	 *
	 * <p>
	 * Useful when paginating results. Returns a maximum of <code>end - start</code> instances. <code>start</code> and <code>end</code> are not primary keys, they are indexes in the result set. Thus, <code>0</code> refers to the first result in the set. Setting both <code>start</code> and <code>end</code> to {@link com.liferay.portal.kernel.dao.orm.QueryUtil#ALL_POS} will return the full result set.
	 * </p>
	 *
	 * @param pk the primary key of the Deportista
	 * @param start the lower bound of the range of Deportistas
	 * @param end the upper bound of the range of Deportistas (not inclusive)
	 * @return the range of NotificacionRechazos associated with the Deportista
	 * @throws SystemException if a system exception occurred
	 */
	public List<slcu.model.NotificacionRechazo> getNotificacionRechazos(
		long pk, int start, int end) throws SystemException {
		return getNotificacionRechazos(pk, start, end, null);
	}

	public static final FinderPath FINDER_PATH_GET_NOTIFICACIONRECHAZOS = new FinderPath(slcu.model.impl.NotificacionRechazoModelImpl.ENTITY_CACHE_ENABLED,
			slcu.model.impl.NotificacionRechazoModelImpl.FINDER_CACHE_ENABLED,
			slcu.model.impl.NotificacionRechazoImpl.class,
			slcu.service.persistence.NotificacionRechazoPersistenceImpl.FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION,
			"getNotificacionRechazos",
			new String[] {
				Long.class.getName(), "java.lang.Integer", "java.lang.Integer",
				"com.liferay.portal.kernel.util.OrderByComparator"
			});

	static {
		FINDER_PATH_GET_NOTIFICACIONRECHAZOS.setCacheKeyGeneratorCacheName(null);
	}

	/**
	 * Returns an ordered range of all the NotificacionRechazos associated with the Deportista.
	 *
	 * <p>
	 * Useful when paginating results. Returns a maximum of <code>end - start</code> instances. <code>start</code> and <code>end</code> are not primary keys, they are indexes in the result set. Thus, <code>0</code> refers to the first result in the set. Setting both <code>start</code> and <code>end</code> to {@link com.liferay.portal.kernel.dao.orm.QueryUtil#ALL_POS} will return the full result set.
	 * </p>
	 *
	 * @param pk the primary key of the Deportista
	 * @param start the lower bound of the range of Deportistas
	 * @param end the upper bound of the range of Deportistas (not inclusive)
	 * @param orderByComparator the comparator to order the results by (optionally <code>null</code>)
	 * @return the ordered range of NotificacionRechazos associated with the Deportista
	 * @throws SystemException if a system exception occurred
	 */
	public List<slcu.model.NotificacionRechazo> getNotificacionRechazos(
		long pk, int start, int end, OrderByComparator orderByComparator)
		throws SystemException {
		Object[] finderArgs = new Object[] { pk, start, end, orderByComparator };

		List<slcu.model.NotificacionRechazo> list = (List<slcu.model.NotificacionRechazo>)FinderCacheUtil.getResult(FINDER_PATH_GET_NOTIFICACIONRECHAZOS,
				finderArgs, this);

		if (list == null) {
			Session session = null;

			try {
				session = openSession();

				String sql = null;

				if (orderByComparator != null) {
					sql = _SQL_GETNOTIFICACIONRECHAZOS.concat(ORDER_BY_CLAUSE)
													  .concat(orderByComparator.getOrderBy());
				}
				else {
					sql = _SQL_GETNOTIFICACIONRECHAZOS;
				}

				SQLQuery q = session.createSQLQuery(sql);

				q.addEntity("SLCU_NotificacionesRechazos",
					slcu.model.impl.NotificacionRechazoImpl.class);

				QueryPos qPos = QueryPos.getInstance(q);

				qPos.add(pk);

				list = (List<slcu.model.NotificacionRechazo>)QueryUtil.list(q,
						getDialect(), start, end);
			}
			catch (Exception e) {
				throw processException(e);
			}
			finally {
				if (list == null) {
					FinderCacheUtil.removeResult(FINDER_PATH_GET_NOTIFICACIONRECHAZOS,
						finderArgs);
				}
				else {
					notificacionRechazoPersistence.cacheResult(list);

					FinderCacheUtil.putResult(FINDER_PATH_GET_NOTIFICACIONRECHAZOS,
						finderArgs, list);
				}

				closeSession(session);
			}
		}

		return list;
	}

	public static final FinderPath FINDER_PATH_GET_NOTIFICACIONRECHAZOS_SIZE = new FinderPath(slcu.model.impl.NotificacionRechazoModelImpl.ENTITY_CACHE_ENABLED,
			slcu.model.impl.NotificacionRechazoModelImpl.FINDER_CACHE_ENABLED,
			slcu.model.impl.NotificacionRechazoImpl.class,
			slcu.service.persistence.NotificacionRechazoPersistenceImpl.FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION,
			"getNotificacionRechazosSize", new String[] { Long.class.getName() });

	static {
		FINDER_PATH_GET_NOTIFICACIONRECHAZOS_SIZE.setCacheKeyGeneratorCacheName(null);
	}

	/**
	 * Returns the number of NotificacionRechazos associated with the Deportista.
	 *
	 * @param pk the primary key of the Deportista
	 * @return the number of NotificacionRechazos associated with the Deportista
	 * @throws SystemException if a system exception occurred
	 */
	public int getNotificacionRechazosSize(long pk) throws SystemException {
		Object[] finderArgs = new Object[] { pk };

		Long count = (Long)FinderCacheUtil.getResult(FINDER_PATH_GET_NOTIFICACIONRECHAZOS_SIZE,
				finderArgs, this);

		if (count == null) {
			Session session = null;

			try {
				session = openSession();

				SQLQuery q = session.createSQLQuery(_SQL_GETNOTIFICACIONRECHAZOSSIZE);

				q.addScalar(COUNT_COLUMN_NAME,
					com.liferay.portal.kernel.dao.orm.Type.LONG);

				QueryPos qPos = QueryPos.getInstance(q);

				qPos.add(pk);

				count = (Long)q.uniqueResult();
			}
			catch (Exception e) {
				throw processException(e);
			}
			finally {
				if (count == null) {
					count = Long.valueOf(0);
				}

				FinderCacheUtil.putResult(FINDER_PATH_GET_NOTIFICACIONRECHAZOS_SIZE,
					finderArgs, count);

				closeSession(session);
			}
		}

		return count.intValue();
	}

	public static final FinderPath FINDER_PATH_CONTAINS_NOTIFICACIONRECHAZO = new FinderPath(slcu.model.impl.NotificacionRechazoModelImpl.ENTITY_CACHE_ENABLED,
			slcu.model.impl.NotificacionRechazoModelImpl.FINDER_CACHE_ENABLED,
			slcu.model.impl.NotificacionRechazoImpl.class,
			slcu.service.persistence.NotificacionRechazoPersistenceImpl.FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION,
			"containsNotificacionRechazo",
			new String[] { Long.class.getName(), Long.class.getName() });

	/**
	 * Returns <code>true</code> if the NotificacionRechazo is associated with the Deportista.
	 *
	 * @param pk the primary key of the Deportista
	 * @param notificacionRechazoPK the primary key of the NotificacionRechazo
	 * @return <code>true</code> if the NotificacionRechazo is associated with the Deportista; <code>false</code> otherwise
	 * @throws SystemException if a system exception occurred
	 */
	public boolean containsNotificacionRechazo(long pk,
		long notificacionRechazoPK) throws SystemException {
		Object[] finderArgs = new Object[] { pk, notificacionRechazoPK };

		Boolean value = (Boolean)FinderCacheUtil.getResult(FINDER_PATH_CONTAINS_NOTIFICACIONRECHAZO,
				finderArgs, this);

		if (value == null) {
			try {
				value = Boolean.valueOf(containsNotificacionRechazo.contains(
							pk, notificacionRechazoPK));
			}
			catch (Exception e) {
				throw processException(e);
			}
			finally {
				if (value == null) {
					value = Boolean.FALSE;
				}

				FinderCacheUtil.putResult(FINDER_PATH_CONTAINS_NOTIFICACIONRECHAZO,
					finderArgs, value);
			}
		}

		return value.booleanValue();
	}

	/**
	 * Returns <code>true</code> if the Deportista has any NotificacionRechazos associated with it.
	 *
	 * @param pk the primary key of the Deportista to check for associations with NotificacionRechazos
	 * @return <code>true</code> if the Deportista has any NotificacionRechazos associated with it; <code>false</code> otherwise
	 * @throws SystemException if a system exception occurred
	 */
	public boolean containsNotificacionRechazos(long pk)
		throws SystemException {
		if (getNotificacionRechazosSize(pk) > 0) {
			return true;
		}
		else {
			return false;
		}
	}

	/**
	 * Initializes the Deportista persistence.
	 */
	public void afterPropertiesSet() {
		String[] listenerClassNames = StringUtil.split(GetterUtil.getString(
					com.liferay.util.service.ServiceProps.get(
						"value.object.listener.slcu.model.Deportista")));

		if (listenerClassNames.length > 0) {
			try {
				List<ModelListener<Deportista>> listenersList = new ArrayList<ModelListener<Deportista>>();

				for (String listenerClassName : listenerClassNames) {
					listenersList.add((ModelListener<Deportista>)InstanceFactory.newInstance(
							listenerClassName));
				}

				listeners = listenersList.toArray(new ModelListener[listenersList.size()]);
			}
			catch (Exception e) {
				_log.error(e);
			}
		}

		containsEquipo = new ContainsEquipo();

		containsNotificacionRechazo = new ContainsNotificacionRechazo();
	}

	public void destroy() {
		EntityCacheUtil.removeCache(DeportistaImpl.class.getName());
		FinderCacheUtil.removeCache(FINDER_CLASS_NAME_ENTITY);
		FinderCacheUtil.removeCache(FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION);
	}

	@BeanReference(type = AlumnoPersistence.class)
	protected AlumnoPersistence alumnoPersistence;
	@BeanReference(type = CategoriaDisciplinaPersistence.class)
	protected CategoriaDisciplinaPersistence categoriaDisciplinaPersistence;
	@BeanReference(type = ConfiguracionPersistence.class)
	protected ConfiguracionPersistence configuracionPersistence;
	@BeanReference(type = CoordinadorPersistence.class)
	protected CoordinadorPersistence coordinadorPersistence;
	@BeanReference(type = DeportistaPersistence.class)
	protected DeportistaPersistence deportistaPersistence;
	@BeanReference(type = DirectorPersistence.class)
	protected DirectorPersistence directorPersistence;
	@BeanReference(type = DisciplinaPersistence.class)
	protected DisciplinaPersistence disciplinaPersistence;
	@BeanReference(type = EquipoPersistence.class)
	protected EquipoPersistence equipoPersistence;
	@BeanReference(type = EscuelaPersistence.class)
	protected EscuelaPersistence escuelaPersistence;
	@BeanReference(type = InscripcionPersistence.class)
	protected InscripcionPersistence inscripcionPersistence;
	@BeanReference(type = InscripcionDisciplinaPersistence.class)
	protected InscripcionDisciplinaPersistence inscripcionDisciplinaPersistence;
	@BeanReference(type = InscripcionMensajePersistence.class)
	protected InscripcionMensajePersistence inscripcionMensajePersistence;
	@BeanReference(type = NotificacionRechazoPersistence.class)
	protected NotificacionRechazoPersistence notificacionRechazoPersistence;
	@BeanReference(type = PartidoPersistence.class)
	protected PartidoPersistence partidoPersistence;
	@BeanReference(type = PersonalDelMinisterioPersistence.class)
	protected PersonalDelMinisterioPersistence personalDelMinisterioPersistence;
	@BeanReference(type = ProfesorPersistence.class)
	protected ProfesorPersistence profesorPersistence;
	@BeanReference(type = PruebaDisciplinaPersistence.class)
	protected PruebaDisciplinaPersistence pruebaDisciplinaPersistence;
	@BeanReference(type = PruebaInscripcionPersistence.class)
	protected PruebaInscripcionPersistence pruebaInscripcionPersistence;
	@BeanReference(type = PuntajePersistence.class)
	protected PuntajePersistence puntajePersistence;
	@BeanReference(type = SolicitudAltaAlumnoPersistence.class)
	protected SolicitudAltaAlumnoPersistence solicitudAltaAlumnoPersistence;
	@BeanReference(type = SolicitudAltaAlumnoMailDestinoPersistence.class)
	protected SolicitudAltaAlumnoMailDestinoPersistence solicitudAltaAlumnoMailDestinoPersistence;
	@BeanReference(type = ResourcePersistence.class)
	protected ResourcePersistence resourcePersistence;
	@BeanReference(type = UserPersistence.class)
	protected UserPersistence userPersistence;
	protected ContainsEquipo containsEquipo;
	protected ContainsNotificacionRechazo containsNotificacionRechazo;

	protected class ContainsEquipo {
		protected ContainsEquipo() {
			_mappingSqlQuery = MappingSqlQueryFactoryUtil.getMappingSqlQuery(getDataSource(),
					_SQL_CONTAINSEQUIPO,
					new int[] { java.sql.Types.BIGINT, java.sql.Types.BIGINT },
					RowMapper.COUNT);
		}

		protected boolean contains(long deportistaId, long equipoId) {
			List<Integer> results = _mappingSqlQuery.execute(new Object[] {
						new Long(deportistaId), new Long(equipoId)
					});

			if (results.size() > 0) {
				Integer count = results.get(0);

				if (count.intValue() > 0) {
					return true;
				}
			}

			return false;
		}

		private MappingSqlQuery<Integer> _mappingSqlQuery;
	}

	protected class ContainsNotificacionRechazo {
		protected ContainsNotificacionRechazo() {
			_mappingSqlQuery = MappingSqlQueryFactoryUtil.getMappingSqlQuery(getDataSource(),
					_SQL_CONTAINSNOTIFICACIONRECHAZO,
					new int[] { java.sql.Types.BIGINT, java.sql.Types.BIGINT },
					RowMapper.COUNT);
		}

		protected boolean contains(long deportistaId, long notificacionId) {
			List<Integer> results = _mappingSqlQuery.execute(new Object[] {
						new Long(deportistaId), new Long(notificacionId)
					});

			if (results.size() > 0) {
				Integer count = results.get(0);

				if (count.intValue() > 0) {
					return true;
				}
			}

			return false;
		}

		private MappingSqlQuery<Integer> _mappingSqlQuery;
	}

	private static final String _SQL_SELECT_DEPORTISTA = "SELECT deportista FROM Deportista deportista";
	private static final String _SQL_SELECT_DEPORTISTA_WHERE = "SELECT deportista FROM Deportista deportista WHERE ";
	private static final String _SQL_COUNT_DEPORTISTA = "SELECT COUNT(deportista) FROM Deportista deportista";
	private static final String _SQL_COUNT_DEPORTISTA_WHERE = "SELECT COUNT(deportista) FROM Deportista deportista WHERE ";
	private static final String _SQL_GETEQUIPOS = "SELECT {SLCU_Equipos.*} FROM SLCU_Equipos INNER JOIN SLCU_Deportistas ON (SLCU_Deportistas.deportistaId = SLCU_Equipos.deportistaId) WHERE (SLCU_Deportistas.deportistaId = ?)";
	private static final String _SQL_GETEQUIPOSSIZE = "SELECT COUNT(*) AS COUNT_VALUE FROM SLCU_Equipos WHERE deportistaId = ?";
	private static final String _SQL_CONTAINSEQUIPO = "SELECT COUNT(*) AS COUNT_VALUE FROM SLCU_Equipos WHERE deportistaId = ? AND equipoId = ?";
	private static final String _SQL_GETNOTIFICACIONRECHAZOS = "SELECT {SLCU_NotificacionesRechazos.*} FROM SLCU_NotificacionesRechazos INNER JOIN SLCU_Deportistas ON (SLCU_Deportistas.deportistaId = SLCU_NotificacionesRechazos.deportistaId) WHERE (SLCU_Deportistas.deportistaId = ?)";
	private static final String _SQL_GETNOTIFICACIONRECHAZOSSIZE = "SELECT COUNT(*) AS COUNT_VALUE FROM SLCU_NotificacionesRechazos WHERE deportistaId = ?";
	private static final String _SQL_CONTAINSNOTIFICACIONRECHAZO = "SELECT COUNT(*) AS COUNT_VALUE FROM SLCU_NotificacionesRechazos WHERE deportistaId = ? AND notificacionId = ?";
	private static final String _FINDER_COLUMN_DNI_DNI_1 = "deportista.dni IS NULL";
	private static final String _FINDER_COLUMN_DNI_DNI_2 = "deportista.dni = ?";
	private static final String _FINDER_COLUMN_DNI_DNI_3 = "(deportista.dni IS NULL OR deportista.dni = ?)";
	private static final String _FINDER_COLUMN_INSCRIPCIONUSERID_INSCRIPCIONSTATUSBYUSERID_2 =
		"deportista.inscripcionStatusByUserId = ?";
	private static final String _ORDER_BY_ENTITY_ALIAS = "deportista.";
	private static final String _NO_SUCH_ENTITY_WITH_PRIMARY_KEY = "No Deportista exists with the primary key ";
	private static final String _NO_SUCH_ENTITY_WITH_KEY = "No Deportista exists with the key {";
	private static final boolean _HIBERNATE_CACHE_USE_SECOND_LEVEL_CACHE = GetterUtil.getBoolean(PropsUtil.get(
				PropsKeys.HIBERNATE_CACHE_USE_SECOND_LEVEL_CACHE));
	private static Log _log = LogFactoryUtil.getLog(DeportistaPersistenceImpl.class);
	private static Deportista _nullDeportista = new DeportistaImpl() {
			@Override
			public Object clone() {
				return this;
			}

			@Override
			public CacheModel<Deportista> toCacheModel() {
				return _nullDeportistaCacheModel;
			}
		};

	private static CacheModel<Deportista> _nullDeportistaCacheModel = new CacheModel<Deportista>() {
			public Deportista toEntityModel() {
				return _nullDeportista;
			}
		};
}